package gameframework;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.Random;



public class TrungGa {

	//tao trung
	private static final long thoigiankhoitao_trung = Framework.secInNanosec *5;
	public static long thoigiangiua2_trung_duoctao = thoigiankhoitao_trung;
public static long thoigiantangcuatrungcuoicung = 0;
	//toc do x,y cua trung tren mang hinh
	  
    public int x_trung;
    public int y_trung;
    //hinh trung ga
    
 //   public static BufferedImage hinh_trung_ga;
    public static BufferedImage hinh_shit_or_egg;
	//toc do va huong theo y
  
    
    
	 private static final double tocdoY_di_chuyen_ban_dau = +2;
	 
	    private static double tocdoY = tocdoY_di_chuyen_ban_dau;
	    //
	    
	    
	public void Initialize(int xtrung,int ytrung)
	{
		this.x_trung=xtrung;
		this.y_trung=ytrung;
		
		//toc do khoi tao
		
	//	tocdoY=+2;
		
	}
	
	public static void khoitaolaibandau()
	{
		TrungGa.thoigiangiua2_trung_duoctao=thoigiankhoitao_trung;
		TrungGa.thoigiantangcuatrungcuoicung = 0;
		TrungGa.tocdoY=tocdoY_di_chuyen_ban_dau;
		
	}
	public static void tangtaodo()
	{
		TrungGa.tocdoY+=2;
	}
	//kiểm  tra trứng không vào rổ
	public boolean kiemtra_trung()
	{
		if(y_trung>=Framework.frameHeight-hinh_shit_or_egg.getHeight())
			return true;
		else
			return false;
	}
	//tốc độ trứng rơi
	public void Update()
	{
		y_trung+=tocdoY;
		
	}
	//
	public void Drawn(Graphics2D g2d)
	{
		
		g2d.drawImage(hinh_shit_or_egg,ConGa.x+ConGa.tocdo_x,y_trung,null);
	}
	
}
